﻿namespace Sidvall.AuthorizationManager.Data.Entity.Model
{
    public class ResourceFactory : global::Sidvall.Data.IResourceFactory
    {
        #region Public Members

        #region CreateItem

        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1822:MarkMembersAsStatic")]
        public object CreateItem(string resource, Sidvall.Data.DataRowState? dataRowState)
        {
            switch (resource)
            {
                case global::Sidvall.AuthorizationManager.Data.Model.DomainObjects.AuthorizationScope:
                    return new global::Sidvall.AuthorizationManager.Data.Entity.Entities.AuthorizationScope(false, null, dataRowState);
                case global::Sidvall.AuthorizationManager.Data.Model.DomainObjects.AuthorizationScopeExport:
                    return new global::Sidvall.AuthorizationManager.Data.Entity.Entities.AuthorizationScopeExport(false, null, dataRowState);
                case global::Sidvall.AuthorizationManager.Data.Model.DomainObjects.AuthorizationScopeResourceAction:
                    return new global::Sidvall.AuthorizationManager.Data.Entity.Entities.AuthorizationScopeResourceAction(false, null, dataRowState);
                case global::Sidvall.AuthorizationManager.Data.Model.DomainObjects.AuthorizationScopeResourceActionClaim:
                    return new global::Sidvall.AuthorizationManager.Data.Entity.Entities.AuthorizationScopeResourceActionClaim(false, null, dataRowState);
                case global::Sidvall.AuthorizationManager.Data.Model.DomainObjects.AuthorizationScopeResourceItem:
                    return new global::Sidvall.AuthorizationManager.Data.Entity.Entities.AuthorizationScopeResourceItem(false, null, dataRowState);
                case global::Sidvall.AuthorizationManager.Data.Model.DomainObjects.AuthorizationScopeResourceItemClaim:
                    return new global::Sidvall.AuthorizationManager.Data.Entity.Entities.AuthorizationScopeResourceItemClaim(false, null, dataRowState);
                case global::Sidvall.AuthorizationManager.Data.Model.DomainObjects.AuthorizationScopeUser:
                    return new global::Sidvall.AuthorizationManager.Data.Entity.Entities.AuthorizationScopeUser(false, null, dataRowState);
                default:
                    return null;
            }
        }
        
        #endregion
        #region CreateItems
        
        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1822:MarkMembersAsStatic")]
        public object CreateItems(string resource)
        {
            switch (resource)
            {
                case global::Sidvall.AuthorizationManager.Data.Model.DomainObjects.AuthorizationScope:
                    return new global::Sidvall.AuthorizationManager.Data.Entity.Entities.AuthorizationScopeCollection();
                case global::Sidvall.AuthorizationManager.Data.Model.DomainObjects.AuthorizationScopeExport:
                    return new global::Sidvall.AuthorizationManager.Data.Entity.Entities.AuthorizationScopeExportCollection();
                case global::Sidvall.AuthorizationManager.Data.Model.DomainObjects.AuthorizationScopeResourceAction:
                    return new global::Sidvall.AuthorizationManager.Data.Entity.Entities.AuthorizationScopeResourceActionCollection();
                case global::Sidvall.AuthorizationManager.Data.Model.DomainObjects.AuthorizationScopeResourceActionClaim:
                    return new global::Sidvall.AuthorizationManager.Data.Entity.Entities.AuthorizationScopeResourceActionClaimCollection();
                case global::Sidvall.AuthorizationManager.Data.Model.DomainObjects.AuthorizationScopeResourceItem:
                    return new global::Sidvall.AuthorizationManager.Data.Entity.Entities.AuthorizationScopeResourceItemCollection();
                case global::Sidvall.AuthorizationManager.Data.Model.DomainObjects.AuthorizationScopeResourceItemClaim:
                    return new global::Sidvall.AuthorizationManager.Data.Entity.Entities.AuthorizationScopeResourceItemClaimCollection();
                case global::Sidvall.AuthorizationManager.Data.Model.DomainObjects.AuthorizationScopeUser:
                    return new global::Sidvall.AuthorizationManager.Data.Entity.Entities.AuthorizationScopeUserCollection();
                default:
                    return null;
            }
        }
        
        #endregion

        #region Current

        private static readonly System.Lazy<ResourceFactory> _Current = new System.Lazy<ResourceFactory>(() => new ResourceFactory());
        public static ResourceFactory Current
        {
            get
            {
                return _Current.Value;
            }
        }

        #endregion

        #endregion
    }
}